package com.jdk.demo.queue.priorityQueue;

import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;

public class Producer implements Runnable {
	PriorityBlockingQueue<PriorityEntity> queue;

    public Producer(PriorityBlockingQueue<PriorityEntity> queue){
        this.queue = queue;
    }

    @Override
    public void run() {
        int i=10;
        while(i>=0){
        	i--;
        	queue.put(new PriorityEntity("A Product: " + i, i));
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }

}